package com.tydic.borderer.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.tydic.borderer.domain.MutualHelpOrganization;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class MutualHelpOrganizationListener implements ReadListener<MutualHelpOrganization> {

    private List<MutualHelpOrganization> mutualHelpOrganizations;

    public MutualHelpOrganizationListener(List<MutualHelpOrganization> mutualHelpOrganizations) {
        this.mutualHelpOrganizations = mutualHelpOrganizations;
    }

    @Override
    public void invoke(MutualHelpOrganization mutualHelpOrganization, AnalysisContext analysisContext) {
        if (mutualHelpOrganizations == null) {
            return;
        }
        mutualHelpOrganizations.add(mutualHelpOrganization);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
